package com.huangwei.test;

import com.huang.serializer.CommonSerializer;
import com.huang.transport.RpcClient;
import com.huang.transport.RpcClientProxy;
import com.huang.transport.netty.client.NettyClient;
import com.huang.serializer.HessianSerializer;
import com.huangwei.rpc.api.ByeService;
import com.huangwei.rpc.api.HelloObject;
import com.huangwei.rpc.api.HelloService;

/**
 * 测试用Netty消费者
 */
public class NettyTestClient {
//    private final static Logger logger = LoggerFactory.getLogger(NettyTestClient.class);
    public static void main(String[] args) {

        RpcClient client = new NettyClient(CommonSerializer.KRYO_SERIALIZER);
        //client.setSerializer(new HessianSerializer());
        RpcClientProxy rpcClientProxy = new RpcClientProxy(client);
        HelloService helloService = rpcClientProxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(12, "This is a message");
        String res = helloService.hello(object);
        System.out.println(res);

        ByeService byeService = rpcClientProxy.getProxy(ByeService.class);
        System.out.println(byeService.bye("Netty"));
;
    }
}
